﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;
using CTP.Entitys;

namespace CTP.ComWrap
{
    [ComVisible(false)]
    public delegate void OnQueryOrderHandle(QueryOrderEventArgs e);

    [Guid("5c2f6411-327e-4997-b3cd-04a38696a850")]
    public interface IQueryOrderEventArgs
    {
        ReturnInfo ReturnInfo { get; set; }
        Order[] Orders { get; set; }
        int RequestID { get; set; }
        int RecordCount { get; }
        Order Get(int index);
    }

    [Guid("31e6c7b0-2689-4eb3-901d-1b1d25b1d8dd")]
    [ClassInterface(ClassInterfaceType.None)]
    public class QueryOrderEventArgs : EventArgs, IQueryOrderEventArgs
    {
        public ReturnInfo ReturnInfo { get; set; }
        public Order[] Orders { get; set; }
        public int RequestID { get; set; }
        public int RecordCount { get { return Orders.Length; } }
        public Order Get(int index)
        {
            if (Orders == null || Orders.Length < 1 || index < 0 || index >= Orders.Length)
                return new Order();

            return Orders[index];
        }
    }

}
